<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/5/20 0020
  Time: 下午 2:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<sql:setDataSource var="db" driver="com.mysql.jdbc.Driver"
                   url="jjdbc:mysql://localhost:3306/sctu-javaweb-2018?serverTimezone=UTC"
                   user="root"  password="123456"/>
<sql:query dataSource="${db}" var="rs">
    SELECT * from t_users;
</sql:query>
<%--借助核心标签库将数据呈现：--%>
<table>
    <c:forEach var="row" items="${rs.rows}">
        <tr>
            <td><c:out value="${row.id}"/></td>
            <td><c:out value="${row.username}"/></td>
            <td><c:out value="${row.password}"/></td>
        </tr>
    </c:forEach>
</table>
<h1>131214</h1>
</body>
</html>
